
$(function () {

    /*========== Loading  ==========*/
    $(".loading").animate({
        "top": "-100%" 
    }, 700, function () {
        console.log('remove')
        $(this).remove();
    });
	

    var $navOpenBtn = $('#nav-open-btn')
    var $navCloseBtn = $('#nav-close-btn')

    var sectionSwiper = new Swiper('#swiper-container', {
        autoplay: false,
        direction: 'vertical',
        mousewheel: true,
        speed: 1000,
        on:{
            init: function(){
              swiperAnimateCache(this); //隐藏动画元素 
              swiperAnimate(this); //初始化完成开始动画
            }, 
            slideChangeTransitionEnd: function(){ 
              swiperAnimate(this); //每个slide切换结束时也运行当前slide动画
              this.slides.eq(this.activeIndex).find('.ani').removeClass('ani'); // 动画只展现一次，去除ani类名
            } 
          }
        
    })

    var productSwiper = new Swiper('#product-container', {
        loop: true,
        navigation: {
            nextEl: '.product-arrow-next',
            prevEl: '.product-arrow-prev',
        },
    })

    var mySwiper2 = new Swiper('#swiper-container2', {
        direction: 'vertical',
        nested: true,
        mousewheel: true,
        slidesPerView: 'auto',
        freeMode: true,
        scrollbar: {
            el: '.swiper-scrollbar',
        },
    })

    $navOpenBtn.click(()=>{
        console.log('ok')
        $(document.body).addClass('mask-show')
        $(document.body).addClass('nav-show')
    })
    $navCloseBtn.click(()=>{
        $(document.body).removeClass('mask-show')
        $(document.body).removeClass('nav-show')
    })
})